package com.zb.set.controller;

import com.zb.entity.AccounLoginInfo;
import com.zb.exception.SMSException;
import com.zb.result.Result;
import com.zb.set.entity.SystemInitVo;
import com.zb.set.service.SetService;
import com.zb.utils.TokenUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @Author WEN
 * @Date 2023/7/26 0026
 **/
@Api(tags = "系统初始化类接口")
@RestController
@RequestMapping("/set/init")
public class SystemInitController {
    @Resource
    private SetService setService;

    @ApiOperation("系统数据初始化")
    @PostMapping("/initSystemSet")
    public Result initSystemSet(HttpServletRequest request, @RequestBody @Valid SystemInitVo systemInitVo) throws SMSException {
        AccounLoginInfo accountLoginInfo = TokenUtil.getAccountLoginInfo(request);
        systemInitVo.setCustAccId(accountLoginInfo.getCustAccId());
        setService.initSystemSet(systemInitVo);
        return Result.success("恢复系统初始化数据成功！");
    }

}
